<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;

/**
* @comment
*
* @property int $id
* @property string $user 登录用户
* @property string $order_sn 订单号
* @property string $account 充值账号
* @property string $coupon 优惠券
* @property string $created_at
* @property string $updated_at
*
*/
class XnH5Order extends Model
{

    /**
     * @var string
     */
    protected $connection = 'mysql';

    /**
     * @var string
     */
    protected $table = 'xn_h5_order';

    /**
     * @var string[]
    */
    protected $fillable = ['id', 'user', 'order_sn', 'account', 'coupon', 'created_at', 'updated_at'];
    protected function serializeDate(\DateTimeInterface $date) {
        return $date->format('Y-m-d H:i:s');
    }
    /**
     * @return HasOne
     */
    public function OrderInfo(): HasOne
    {
        return $this->hasOne(XnBatchOrder::class,'merchantOrderNum','order_sn');
    }
    /**
     * @return HasOne
     */
    public function couponInfo(): HasOne
    {
        return $this->hasOne(NsSupplierGoodsCoupon::class,'coupon','coupon');
    }
}
